package scanner.com.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.GridView;


import com.haha.extend.HeadBar.BaseHeaderView;
import com.haha.extend.HeadBar.ImageInLeftAndRight;

import scanner.com.scanner.R;


/**
 * Created by Administrator on 2016/7/5.
 */
public class UrlActivity extends AppCompatActivity{
    private ImageInLeftAndRight header;
    private EditText decodedUrlET;
    private GridView sendGV;
    private View bos;
    private  String  KEY="son";
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_decoded_contact);
        findView();
        initView();
    }

    private void findView() {
        header = (ImageInLeftAndRight) findViewById(R.id.header_co);
        decodedUrlET = (EditText) findViewById(R.id.decoded_text);
        sendGV = (GridView) findViewById(R.id.send_gs);
        bos=findViewById(R.id.btnos);
    }

    private void initView() {

        header.setOnHeaderClickListener(onHeaderClickListener);
        bos.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri=Uri.parse(decodedUrlET.getText().toString());
                Intent intent = new Intent(Intent.ACTION_VIEW,uri);
             //   Intent intent1=new Intent(UrlActivity.this,QRMakeActivity.class);
              //  intent1.putExtra(KEY,decodedUrlET.getText().toString());
                startActivity(intent);
               // startActivity(intent1);

            }
        });

    }

    private BaseHeaderView.OnHeaderClickListener onHeaderClickListener = new BaseHeaderView.OnHeaderClickListener() {
        @Override
        public void onHeaderLeftClicked() {
            finish();

        }

        @Override
        public void onHeaderCenterClicked() {

        }

        @Override
        public void onHeaderRightClicked() {
            startActivity(new Intent(UrlActivity.this,QRMakeActivity.class));

        }
    };


}
